package czxy.dao;

import czxy.domain.Teacher;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface TacherMapper {


    @Select("select  *  from  teacher where tid = #{tid}")
    @Results(id = "teacherAllInfo",value = {
            @Result(property = "tid",column = "tid"),
            @Result(property = "studentList",
                    many = @Many(select = "czxy.dao.StudentMapper.findStudentsByTid")
                    ,column = "tid")

    })
    public Teacher findTeacherByTid(@Param("tid") Integer  tid);




    //
    @Select("select *  from  teacher")
    @ResultMap("teacherAllInfo")
    public List<Teacher> findAllTeacherInfo();


    @Select("select  *  from teacher t ,teacher_student  ts where  t.tid = ts.student_id  and student_id = #{sid}")
    public  List <Teacher> findTeachersBySid(@Param("sid") Integer sid);






}


